package com.cn.mobileproject.activity;

import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.TextView;

import com.cn.mobileproject.R;

public class HeaderActivity  extends BaseActivity{
	
	protected TextView mTitleText;
	protected Button mLeftBtn;
	protected Button mRightBtn;
	
	
	protected void initComponent(){
		mLeftBtn = (Button) this.findViewById(R.id.header_btn_back);
		mRightBtn = (Button) this.findViewById(R.id.header_btn_right);
		mTitleText = (TextView) this.findViewById(R.id.header_text_title);
	}
	
	protected void initComponentValue(){
		
	}
	
	protected void initEvent(){
		if(mLeftBtn!=null){
			mLeftBtn.setOnClickListener(new OnClickListener(){
				@Override
				public void onClick(View v) {
					leftBtnOnClick();
				}
			});
		}
		
		if(mRightBtn!=null){
			mRightBtn.setOnClickListener(new OnClickListener(){
				@Override
				public void onClick(View v) {
					rightBtnOnClick();
				}
			});
		}
		
	}
	
	protected void leftBtnOnClick(){
		finish();
	}
	
	protected void rightBtnOnClick(){
		
	}
	
	protected void setHeaderTitle(String title){
		if(null!=mTitleText){
			mTitleText.setText(title);
		}
	}

}
